/* << fastinsert report library >> IGrid.h Oct 30, 2010
 *
 * 	http://code.google.com/p/libfir
 *
 * Copyright (c) 2005 Pavlo Drobov (drobov.pavel@gmail.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */

#ifndef IGRID_H_
#define IGRID_H_

#include "win32_export_macros.h"

namespace dasco
{
namespace report
{

//! \struct IOutline
//! \brief interface for outline essence
//!
struct DLL_EXPORT IOutline
{
	virtual ~IOutline(){}
	virtual const char* asText() const = 0;
};

//! \struct IIterator
//! \brief interface iterator for ICollection
template<typename T>
struct DLL_EXPORT IIterator
{
	virtual ~IIterator(){}
	virtual IIterator& operator ++(int) = 0;
	virtual operator T() = 0;
	virtual T operator -> () = 0;
};

//! \struct ICollection
//! \brief interface for collections
template<typename T>
struct ICollection
{
	virtual ~ICollection(){}
	virtual IIterator<T>& getIterator() = 0;
};

//! \struct ICell
//! \brief interface for cell essences
struct DLL_EXPORT ICell
	:IOutline
{
	enum CellType
	{
		CellInt = 0
	   ,CellFloat
	   ,CellText
	   ,CellUnknown
	};

	ICell() : cellType(CellUnknown){}
	virtual ~ICell(){}

	CellType cellType;

	virtual unsigned getLength() const = 0;
	virtual operator const char* () const = 0;
};

//! \class IRowSet
//! \brief interface for RowSet essences
class DLL_EXPORT IRowSet
	:public ICollection<ICell*>
	,public IOutline
{
public:
	virtual ~IRowSet(){}

	virtual void addColumn(const int) 	= 0;
	virtual void addColumn(const float) = 0;
	virtual void addColumn(const char*) = 0;

	virtual unsigned cellQuantity() const  = 0;
};

//TODO: make more documentation for Header iface

//! \class IRowSetHeader
//! \brief interface for header RowSet
class DLL_EXPORT IRowSetHeader
	:virtual public IRowSet
{
};

//! \class IGrid
//! \brief interface for Grid essences
class DLL_EXPORT IGrid
	:public ICollection<IRowSet*>
	,public IOutline
{
public:
	virtual ~IGrid(){}
	virtual void addRow(IRowSet*) = 0;
};

}} //end namespace dasco::report


#endif /* IGRID_H_ */
